print("6666")
local testTable = {
  {itemID=1, slotIndex=2},
  {itemID=2, slotIndex=3},
}


function TableToString(tbl)
  local result = "{"
  
  for key, value in pairs(tbl) do
      result = result .. "[" .. tostring(key) .. "] = "
      
      if type(value) == "table" then
          result = result .. TableToString(value)  -- 递归调用
      else
          result = result .. tostring(value)
      end
      
      result = result .. ", "
  end
  
  -- 去掉最后的逗号和空格
  result = result:sub(1, -3) .. "}"
  
  return result
end

print(TableToString(testTable))